const arr = [1, [2, [3, [4]]]];
console.log(arr.flat(Infinity)); // [ 1, 2, 3, 4 ]
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
